<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>欢迎登陆</title>
  <link rel="stylesheet" href="./login.css">
</head>
<body>
  <div id="app">
    <form action="" id="form">
      <label>用户名</label>
      <input type="text"
        id="username" v-model="username"><br />
      <label>密码</label>
      <input type="password"
        id="pwd" v-model="password"><br />
      <input type="button" :value="val1" onclick="login()">
    </form>
    <button v-on:click="change()">变成注册</button>
    <p>你的用户名是：{{username}}，密码是：{{password}}</p>
  </div>
  <!-- <script src="./login.js"></script> -->
  <!-- 引入vue的源码 -->
  <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
  <script>
    // 创建一个vue实例
    let vm = new Vue({
      // 元素
      el: '#app',
      // 数据初始化
      data: {
        username: '',
        password: '',
        val1: '登录'
      },
      // 函数
      methods: {
        change() {
          this.val1 = '注册'
        }
      },
    })
  </script>
</body>

</html>